Skip to content

Conversation

@AlejandroFernandezLuces
Copy link
Collaborator

@AlejandroFernandezLuces AlejandroFernandezLuces commented Jun 19, 2025

Overview

This PR fixes an unexpected behaviour in the show method, where optional keyword arguments were being passed only to plot in case users were passing plottable objects to the show method.

This caused that optional keyword arguments that needed to be passed to the underlying PyVista method show weren't reaching it. If you passed the plottable object and the optional keyword arguments destinated to the pyvista show method, an error would be thrown.

New behaviour

Now if you need to pass plottable objects directly to show, you can pass a dictionary through ``plotting_options` argument where you can add the PyVista plotting options for that plottable object.

Before

    pl = Plotter()
    sphere = pv.Sphere()

    # breaks
    pl.show(sphere, show_edges=True, cpos="xy")
    
    
    # Correct way
    pl.plot(sphere, show_edges=True)
    pl.show(cpos="xy")
    

Now

    pl = Plotter()
    sphere = pv.Sphere()
    pl.show(sphere, plotting_options={"show_edges": True}, cpos="xy")

Associated issues

ansys/pymechanical#1189

@github-actions github-actions bot added testing Anything related to testing enhancement New features or code improvements labels Jun 19, 2025
Copy link
Contributor

@SMoraisAnsys SMoraisAnsys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I left a minor comment that you can discard if needed

@AlejandroFernandezLuces AlejandroFernandezLuces enabled auto-merge (squash) June 19, 2025 09:18
@AlejandroFernandezLuces AlejandroFernandezLuces merged commit f8e2507 into main Jun 19, 2025
23 checks passed
@AlejandroFernandezLuces AlejandroFernandezLuces deleted the feat/improve-opt-args branch June 19, 2025 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New features or code improvements testing Anything related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants